home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F27258_EmployeesToXML.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  1.6 KB  |  53 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       XSLT
  4.   Sub-category:   xsl:output
  5.   Author:         David Silverlight
  6.                   HeadGeek@xmlpitstop.com
  7.   Created:        2001-05-16
  8.   Description:-
  9.     This stylesheet processes a set of XML elements and displays
  10.     the result in XML.  This is accomplished using the output
  11.     method of XML as     shown above.  In this example, we are
  12.     taking the original xml elements and creating a new xml
  13.     document sorted by name.
  14.  =============================================================== -->
  15. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
  16.  
  17. <!-- Note: The following XSLT method is required to specify the output type of XML -->
  18. <xsl:output method="xml"/>
  19.  
  20.  
  21.  
  22. <!-- Template for root rule -->
  23. <xsl:template match="/">
  24.     <xsl:apply-templates/>
  25. </xsl:template>
  26.  
  27.  
  28. <!-- Template for "employees" elements -->
  29. <xsl:template match="employees">
  30.     <!--This stylesheet processes a set of XML elements and 
  31.     displays the result in XML.  This is accomplished using the output method of XMl as
  32.     shown above.  In this example, we are taking the original xml elements and 
  33.     creating a new xml document sorted by name-->
  34.     <emloyees>
  35.     <xsl:for-each select="employee" >
  36.         <xsl:sort select="employeename" order="ascending" />
  37.  
  38.  
  39.         <employee>
  40.             <xsl:copy-of select="department" />
  41.             <xsl:copy-of select="employeename" />
  42.             <xsl:copy-of select="hourlyrate" />
  43.             <xsl:copy-of select="primarylanguage" />
  44.         </employee>
  45.  
  46.  
  47.     </xsl:for-each>
  48.     </emloyees>
  49. </xsl:template>
  50.  
  51.  
  52.  
  53. </xsl:stylesheet>